import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import pinia from './stores'
import { printEnvInfo } from './utils/env'

// 导入Vant组件
import {
	Button,
	Tabbar,
	TabbarItem,
	NavBar,
	Cell,
	CellGroup,
	Field,
	Popup,
	Picker,
	Uploader,
	Loading,
	Toast,
	Dialog,
	Icon,
	showToast,
	showDialog,
	showConfirmDialog,
} from 'vant'
import 'vant/lib/index.css'

// 打印环境信息
printEnvInfo()

const app = createApp(App)

// 注册Vant组件
app.use(Button)
app.use(Tabbar)
app.use(TabbarItem)
app.use(NavBar)
app.use(Cell)
app.use(CellGroup)
app.use(Field)
app.use(Popup)
app.use(Picker)
app.use(Uploader)
app.use(Loading)
app.use(Toast)
app.use(Dialog)
app.use(Icon)

// 全局方法
app.config.globalProperties.$toast = showToast
app.config.globalProperties.$dialog = showDialog
app.config.globalProperties.$confirm = showConfirmDialog

// 使用路由
app.use(router)

// 使用状态管理
app.use(pinia)

app.mount('#app')
